package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.ProductSkuVo;
import com.spzx.product.api.factory.RemoteProductServiceFallbackFactory;
import com.spzx.product.api.fallback.RemoteProductServiceFallback;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(
//        contextId = "remoteProductService",
        value = ServiceNameConstants.PRODUCT_SERVICE,
        //fallback = RemoteProductServiceFallback.class,
        fallbackFactory = RemoteProductServiceFallbackFactory.class)
public interface RemoteProductService {
    @Operation(summary = "获取商品SKU详情")
    @GetMapping("/productSku/getProductSku/{skuId}")
    R<ProductSkuVo> getProductSku(
            @Parameter(description = "skuId")
            @PathVariable("skuId") Long skuId,

            @Parameter(description = "source")
            @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
